<?php
namespace app\cms\model;
/* *
 * 网站配置
 * */
class Setting extends \app\base\model\AdminModel{
    protected $table ='cms_config';  //模型表

    //列表
    public function _select(){
        $rel = $this->select();
        if($rel){
            foreach ($rel as $key => $value) {
                $data[$value['title']] = $value['content'];
            }
            return $data;
        }else{
            return FALSE;
        }
    }

    //单个
    public function _find($condition){
        return $this->where($condition)->find();
    }

    //编辑
    public function _update($data,$condition){
        $rel = $this->_find($condition);
        if($rel){
            return $this->where($condition)->data($data)->update();
        }else{
            return $this->data($data)->insert();
        }
    }  
}